package com.model;

import java.util.Date;

public class MyPublisher extends AbstractPublisher {
	private String subject;
	 private Date pubTime;
	 
	 public MyPublisher() {
	  
	 }
	 
	 public MyPublisher(String subject, Date pubTime) {
	  this.subject = subject;
	  this.pubTime = pubTime;
	 }

	 public String getSubject() {
	  return subject;
	 }
	 
	 /**
	  * 当使用setSubject方法来修改主题时
	  * 程序自动触发发布者的所有订阅者监听事件
	  * @param subject
	  */
	 public void setSubject(String subject) {
	  this.subject = subject;
	  noticeSubscriber(subject);
	 }
	 
	 public Date getPubTime() {
	  return pubTime;
	 }
	 
	 /**
	  * 当使用setSubject方法来修改发布时间时
	  * 程序自动触发发布者的所有订阅者监听事件
	  * @param pubTime
	  */
	 public void setPubTime(Date pubTime) {
	  this.pubTime = pubTime;
	  noticeSubscriber(pubTime);
	 }
}
